<!-- 我的推荐列表 -->
<template>
  <view class="content">
    <view class="item"v-for="(item, index) in list" :key="index">
      <view class="shopname">
        <image class="shoptu" :src="item.shop_image"></image>
        <text class="title">{{item.shop_name}}</text>
      </view>
      <!-- 此层wrap在此为必写的，否则可能会出现标题定位错误 -->
      <view class="title-wrap">
        <view class="item-price">
          <text>交易人数：{{item.pay_num}}</text>
        </view>
        <view class="item-price">
          <text>交易金额：{{item.pay_amount}}</text>
        </view>
        <view class="item-price">
          <text>交易提点：{{item.pay_reward}}</text>
        </view>
      </view>
    </view>

    <!-- 加载更多 -->
    <u-loadmore v-show="!isEmpty" height="80rpx" :status="loadStatus" icon-type="flower" color="#ccc" />
    <!-- 空置页 -->
    <shopro-empty v-if="isEmpty" marginTop="200rpx" :image="$IMG_URL + '/imgs/empty/no_data.png'" tipText="暂无数据~">
    </shopro-empty>
  </view>
</template>

<script>
export default {
  components: {},
  data() {
    return {
      isEmpty: false,
      list: [],
      listParams: {
        token:uni.getStorageSync("token"),
        page: 1
      },
      storeId: uni.getStorageSync('storeId'),
      disabled: false,
      btnWidth: 180,
      show: false,
    };
  },
  computed: {},
  onShow() {
    this.list = [];
    this.listParams.page = 1;
    this.getofferList();
  },
  onLoad() {
  },
  // 触底加载更多
  onReachBottom() {
    if (this.listParams.page < this.lastPage) {
      this.listParams.page += 1;
      this.getofferList();
    }
  },
  methods: {
    // 获取门店列表
    getofferList() {
      let that = this;
      that.$http_business('order.offerList',that.listParams).then(res => {
        if (res.code == 1) {
          that.list = [...that.list, ...res.data.data];
          that.isEmpty = !that.list.length;
          that.lastPage = res.data.last_page;
          that.loadStatus = that.listParams.page < res.data.last_page ? 'loadmore' : 'nomore';
        }
      });
    },
  }
};
</script>

<style lang="scss">
.content {
  padding-bottom: 130rpx;
  background-color: #F8F8F8;
}

.title-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  margin-top: 12rpx;
  flex-direction: column;
}

.item {

  box-sizing: border-box;
  margin: 20rpx 20rpx 0rpx;
  padding: 25rpx;
  background: #fff;
  .shopname{
    display: flex;
    align-items: center;
    border-bottom: 2rpx dashed #ccc;
    padding-bottom: 20rpx;
    image {
      width: 60rpx;
      height: 60rpx;
      display: inline-block;
      margin-right: 24rpx;
      border-radius: 12rpx;
    }
  }

}



.item-price {
  font-size: 26rpx;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 500;
  color: #333333;
  line-height: 36rpx;
  padding: 10rpx 0;
}

.item-tool {
  // margin-top: 26rpx;
  display: flex;
}

.tool-item {
  margin-top: 15rpx;
  padding: 0rpx 30rpx;
  line-height: 52rpx;
  text-align: center;
  border-radius: 26rpx;
  border: 1px solid #D1D2D5;
  font-size: 20rpx;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  color: #666666;
  margin-bottom: 24rpx;
}

.tool-item:first-child {
  margin-left: auto;
}

.foot_box {
  position: fixed;
  bottom: 0;
  width: 100%;
  background: rgba(255, 255, 255, 1);
  padding: 24rpx 30rpx;

  .save-btn {
    width: 100%;
    line-height: 80rpx;
    background: #FC5351;
    border: 1rpx solid rgba(238, 238, 238, 1);
    font-size: 32rpx;
    font-weight: 500;
    color: rgba(255, 255, 255, 1);
    border-radius: 40rpx;
  }
}
</style>
